<template>
  <div class="avue-logo">
    <transition name="fade">
      <span v-if="keyCollapse" key="0" class="avue-logo_subtitle" @click="goIndex">
        {{website.subtitle}}
        <!-- <img :src="icon" class="logo-icon" /> -->
      </span>
    </transition>
    <transition-group name="fade">
      <span v-if="!keyCollapse" key="1" class="avue-logo_title" @click="goIndex">
        <!-- {{ website.title }} -->
        <!-- <img :src="icon" class="logo-icon" /> -->
        <span class="logo-name">{{website.title}}</span>
      </span>
    </transition-group>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
export default {
  name: 'Logo',
  data(){
    return{ 
      icon: this.$icon.logo
    }
  },
  computed: {
    ...mapGetters(['website', 'keyCollapse'])
  },
  methods: {
    goIndex: function () {
      this.$store.commit('REMOVE_LIKE_TOP_MENUID')
      window.location.href = '/'
    }
  }
}
</script>

<style lang="scss">
.fade-leave-active {
  transition: opacity 0.2s;
}
.fade-enter-active {
  transition: opacity 2.5s;
}
.fade-enter,
.fade-leave-to {
  opacity: 0;
}

.avue-logo {
  position: fixed;
  top: 0;
  left: 0;
  width: 200px;
  height: 64px;
  // padding: 15px;
  // line-height: 64px;
  // background-color: #001454;
  font-size: 20px;
  overflow: hidden;
  box-sizing: border-box;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.15);
  // color: rgba(255, 255, 255, 0.8);
  color:#fff;
  z-index: 1024;
  &_title {
    display: block;
    text-align: left;
    font-weight: 300;
    font-size: 18px;
    .logo-icon{
      margin:17px 15px;float:left;
    }
    .logo-name{
      display:inline-block;padding:15px 30px;position:relative;color:#fff;font-weight:bold;
      &::before{
        content: '';height:20px;width:1px;background:rgba(220,223,230, 0.5);position:absolute;top:50%;left:0;transform: translateY(-50%);
      }
    }
  }
  &_subtitle {
    display: block;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    padding:15px 0;
    .logo-icon{
      margin:17px 0;
    }
  }
  .logo-icon{
    height:30px;
  }
  
}
</style>
